import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { PageSelecter } from "../../common/pageSelect/PageSelecter";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class DomWarBeaBaseListPannel
    
    export  class DomWarBeaBaseListPannel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this.header = ResouceConst.getScaleBitmap("RbListHeader");
            this.header.height = 35;
            this.header.width = 540;
            this.header.x = 17;
            this.header.y = 27;
            addChild(this.header);
            this._cellList = new GTileList();
            this._cellList.setStyle("skin", new Object /* flash.display.Bitmap */());
            this._cellList.verticalScrollPolicy = ScrollPolicy.OFF;
            this._cellList.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._cellList.scrollPolicy = ScrollPolicy.OFF;
            this._cellList.columnCount = 1;
            this._cellList.rowCount = 12;
            this._cellList.rowHeight = 30;
            this._cellList.columnWidth = 510;
            this._cellList.useFixed = true;
            this._cellList.setSize(510, 370);
            this._cellList.move(38, 64);
            this.addChild(this._cellList);
            this._pageSelector = new PageSelecter();
            this.addChild(this._pageSelector);
            this._pageSelector.x = 365;
            this._pageSelector.y = 0;
            this._pageSelector.mode = PageSelecter.SingleMode;
            this._pageSelector.addEventListener(flash.events.Event.CHANGE, this.onPageChange);
            this._pageSelector.x = 231;
            this._pageSelector.y = 427;
            return;
        }

        protected onPageChange(arg1: Object /* flash.events.Event */): void
        {
            this.updatePageData();
            return;
        }

        protected updatePageData(): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=0;
            if (this._allData) 
            {
                loc1 = (this._pageSelector.currentPage - 1);
                loc2 = this._cellList.rowCount * this._cellList.columnCount;
                loc3 = loc1 + loc2;
                this._pageData = this._allData.slice(loc1, loc3);
                this._cellList.dataProvider = new DataProvider(this._pageData);
            }
            return;
        }

        public /* override */ update(arg1: Object, ... rest): void
        {
            return;
        }

        protected /* var */_cellList: GTileList;

        protected /* var */_pageSelector: PageSelecter;

        protected /* var */_pageData: Array<any>;

        protected /* var */_allData: Array<any>;

        protected /* var */header: ScaleBitmap;
    }
